#include "stdafx.h"
#include "cursorMgr_t.h"
#include <HGETools.h>

cursorMgr_t::cursorMgr_t()
{
	curState = CURSORS_STATE_NORMAL;
	curFrame = 0;

	addPic(CURSORS_STATE_NORMAL, "newpmClientRes\\UI\\cursor.png");
	addPic(CURSORS_STATE_GROUP, "newpmClientRes\\UI\\captainTag.png");
}


void cursorMgr_t::addPic(CURSORS_STATE state, const string& pic)
{
	HTEXTURE t	=	hgeResMgr::GetSingleton()->GetTexture(pic.c_str());
	HGE * hge = hgeCreate( HGE_VERSION );
	hgeSprite* spr = new hgeSprite( t, (float)0, (float)0, (float)hge->Texture_GetWidth(t), (float)hge->Texture_GetHeight(t) );

	cursors[state].push_back(spr);
}


void cursorMgr_t::draw()
{
	HGE * hge = hgeCreate( HGE_VERSION );

	float mx=0.0f, my=0.0f;
	hge->Input_GetMousePos(&mx,&my);
	cursors[curState][curFrame]->Render(mx, my);

	curFrame++;
	if (curFrame>=cursors[curState].size())
	{
		curFrame = 0;
	}
}